package com.elephant.core.dynamicagent.cglib;

import com.elephant.core.dynamicagent.jdk.UserService;
import com.elephant.core.dynamicagent.jdk.UserServiceImpl;
import net.sf.cglib.proxy.Enhancer;

/**
 * @author hai
 * @description
 * @date 16:06 2018/8/20
 */
public class Test {

    public static void main(String[] args) {
        CglibProxy cglibProxy = new CglibProxy();

        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(UserServiceImpl.class);
        enhancer.setCallback(cglibProxy);

        UserService o = (UserService)enhancer.create();
        o.getName(1);
        o.getAge(1);
    }
}
